package com.dinzeer.foxextra.data;

import com.dinzeer.foxextra.Foxextra;
import mods.flammpfeil.slashblade.data.builtin.SlashBladeBuiltInRegistry;
import mods.flammpfeil.slashblade.init.SBItems;
import mods.flammpfeil.slashblade.recipe.RequestDefinition;
import mods.flammpfeil.slashblade.recipe.SlashBladeIngredient;
import mods.flammpfeil.slashblade.recipe.SlashBladeShapedRecipeBuilder;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.world.item.Items;
import net.minecraftforge.common.crafting.conditions.IConditionBuilder;

import java.util.function.Consumer;

public class FEXRecipeProvioder extends RecipeProvider implements IConditionBuilder {
    //合成表datagen
    public FEXRecipeProvioder(PackOutput output) {
        super(output);
    }
    protected void buildRecipes(Consumer<FinishedRecipe> consumer){

        SlashBladeShapedRecipeBuilder.shaped(FEXSlashBladeButilnRegsitry.foxex_white.location())
                .pattern("ABA")
                .pattern("CDC")
                .pattern("ACA")
                .define('A', Items.GLOWSTONE)
                .define('B', Items.NETHER_STAR)
                .define('C', Items.DIAMOND_BLOCK)
                .define('D', SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(SlashBladeBuiltInRegistry.FOX_WHITE.location())
                                .killCount(1500)
                                .proudSoul(12000)
                                .refineCount(6)
                                .build()
                ))

                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(FEXSlashBladeButilnRegsitry.foxex_black.location())
                .pattern("ABA")
                .pattern("CDC")
                .pattern("ACA")
                .define('A', Items.GLOWSTONE)
                .define('B', Items.NETHER_STAR)
                .define('C', Items.DIAMOND_BLOCK)
                .define('D',SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(SlashBladeBuiltInRegistry.FOX_BLACK.location())
                                .killCount(1500)
                                .proudSoul(12000)
                                .refineCount(6)
                                .build()
                ))

                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(FEXSlashBladeButilnRegsitry.foxexfinal.location())
                .pattern("ABA")
                .pattern("CDC")
                .pattern("AEA")
                .define('E', Items.GLOWSTONE)
                .define('B', Items.DRAGON_EGG)
                .define('A', Items.DIAMOND_BLOCK)
                .define('D',SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(FEXSlashBladeButilnRegsitry.foxex_white.location())
                                .killCount(1000)
                                .proudSoul(30000)
                                .refineCount(20)
                                .build()
                ))
                .define('C',Items.OBSIDIAN)

                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(FEXSlashBladeButilnRegsitry.foxexfinal.location())
                .pattern("ABA")
                .pattern("CDC")
                .pattern("AEA")
                .define('C', Items.GLOWSTONE)
                .define('B', Items.DRAGON_EGG)
                .define('A', Items.DIAMOND_BLOCK)
                .define('D',SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(FEXSlashBladeButilnRegsitry.foxex_black.location())
                                .killCount(1000)
                                .proudSoul(30000)
                                .refineCount(20)
                                .build()
                ))
                .define('E',Items.OBSIDIAN)

                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer, Foxextra.MODID + ":foxexfinal_2");
    }
}
